package com.first.agent.web.controller; /**
 * Created with IntelliJ IDEA.
 * User: ljc
 * Date: 2022/11/17 13:42
 * Description:
 * Version: V1.0
 */

import com.alibaba.fastjson.JSONObject;
import com.first.agent.common.R;
import com.first.agent.service.ReportService;
import com.first.agent.service.impl.ReportServiceImpl;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;
import java.io.PrintWriter;

@WebServlet(name = "AgentServlet", value = "/AgentServlet")
public class AgentServlet extends HttpServlet {


    @Override
    protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        ReportService reportService=new ReportServiceImpl();
        String start=request.getParameter("start");
        String end=request.getParameter("end");
        R r=reportService.findAgent(start,end);
        response.setContentType("application/json;charset=utf-8");
        PrintWriter pw = response.getWriter();
        pw.write(JSONObject.toJSONString(r));
        pw.flush();
        pw.close();
    }

}
